package main

import (
	"gitee.com/ChangPaoZhe/client/app/cmdb"
	"gitee.com/ChangPaoZhe/client/config"
	"gitee.com/ChangPaoZhe/client/ioc"
	"gitee.com/ChangPaoZhe/client/protocol"
	_ "gitee.com/ChangPaoZhe/client/registory"
)

func main(){
	fp:="/home/jasonbzhang/work/script/golang/client/etc/application.toml"
	err := config.LoadConfigFromToml(fp)
	if err != nil {
		panic(err)
	}
	// 调用常规服务，用于注册和生成基础模块
	err=ioc.InitService()
	if err != nil {
		panic(err.Error())
	}
	CmdbImpl:=ioc.GetServer(cmdb.App_Name).(*cmdb.CmdbImpl)
	go  CmdbImpl.Register()
	if config.C.CrontabStatus.Enable==true {
		go func(){
			config.C.CrontabStatus.Crontab.AddFunc(config.C.CrontabStatus.Spec,CmdbImpl.Healther)
			config.C.CrontabStatus.Crontab.Start()
			select {}
		}()
	}
	grpc:=protocol.NewGrpc()
	grpc.Start()

}